basic-syscall
System Calls
Enter the support/basic-syscall/
folder and go through the practice items below.
If you get stuck, take a sneak peek at the solutions in the solution/basic-syscall/
folder.
For debugging, use strace
to trace the system calls from your program and make sure the arguments are set right.
Update the
hello.asm
and / orhello.s
files to pause the execution of the program before theexit
system call.You need to make the
sys_pause
system call, with no arguments. Find its ID here.Update the
hello.asm
and / orhello.s
files to read a message from standard input and print it to standard output.You'll need to define a buffer in the
data
orbss
section. Use theread
system call to read data in the buffer. The return value ofread
(placed in therax
register) is the number of bytes read. Use that value as the 3rd argument orwrite
, i.e. the number of bytes printed.Find the ID of the
read
system call here. To find out more about its arguments, see its man page. Standard input descriptor is0
.Difficult: Port the initial program to ARM on 64 bits (also called aarch64).
Use the skeleton files in the
arm/
folder. Find information about the aarch64 system calls here.Create your own program, written in assembly, doing some system calls you want to learn more about. Some system calls you could try:
open
,rename
,mkdir
. Create a Makefile for that program. Run the resulting program withstrace
to see the actual system calls being made (and their arguments).